package com.itheima.loadinghomework;

public class UserService {
    private String username;
    private String password;

    public void register (String username,String password) throws MyException{
        if(username==null || password==null){
            throw new MyException("用户名或密码为空！");
        }
        else if(username.length()<6 ||username.length()>14){
            throw new MyException("用户名长度不合法！");
        }
        else{
            this.username=username;
            this.password=password;
            System.out.println(username+"注册成功！");
        }
    }
    public String getUserName(){
        return this.username;
    }
    public String getPassword(){
        return this.password;
    }

}
